package ustc.running.ui;

import java.util.List;
import java.util.Map;

import ustc.running.R;
import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;

/**
 * 显示记录数据
 * @author 李跃东
 * 
 */

public class RecorderUi extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		this.setContentView(R.layout.record_ui);
		ListView listView = (ListView) findViewById(R.id.recorder_data);
		Button back = (Button) findViewById(R.id.back);

		Resources resources = this.getResources();
		this.setTitle(resources.getString(R.string.recorder_data));

		@SuppressWarnings("unchecked")
		List<Map<String, String>> data = (List<Map<String, String>>) this
		.getIntent().getSerializableExtra("data");

		SimpleAdapter adapter = new SimpleAdapter(this, data, R.layout.item_ui,
				new String[] { "number", "time" }, new int[] { R.id.number,
				R.id.time });

		listView.setAdapter(adapter);

		back.setOnClickListener(new Button.OnClickListener() {

			@Override
			public void onClick(View v) {
				RecorderUi.this.finish();				
			}
		});

	}
}
